package ClientAnneau;

import org.omg.CORBA.*;
import Annuaire.impl.*;
import Annuaire.*;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
import org.omg.CosNaming.NamingContextPackage.NotFound;
public class ClientMain{

	static Service serviceImpl; 
	static ClientImpl clientImpl;
  public static void main(String args[])
  {
   try{
      // create and initialize the ORB
      ORB orb = ORB.init(args, null);
      // get the root naming context
      org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

      // resolve the Object Reference in Naming
      	String path = "test";
	serviceImpl = ServiceHelper.narrow(ncRef.resolve_str(path));
	//on a récupérer un objet de service
	clientImpl = new ClientImpl(serviceImpl);
  } catch (Exception e) {
      System.out.println("ERROR : " + e) ;
      e.printStackTrace(System.out);
  }




}



}
